﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HKEA.CMS.Core.BLL;
using HKEA.CMS.Core.BLL.Tbl;
namespace HKEA.CMS.Core.Models
{
    public class BrandListDetail:mtblBrand
    {
        public string BrandName
        {
            get
            {
                string str = BrandName_Eng + "&nbsp;" + BrandName_Chi;
                if (BrandLogo > 0)
                    str += "<img src=\"/Media/Css/images/cphsmedia.png\" />";
                return str;
            }
        }
        public int Deleted { get; set; }
        public string SourceType { get; set; }
        public string strCat {
            get {
                StringBuilder strBuilder = new StringBuilder();
                tblBrand_ProdCatBLL bll = new tblBrand_ProdCatBLL();
                List<mtblProductSubCat> subCatList = new List<mtblProductSubCat>();
                subCatList = bll.GetSubCatListByBrandUID(BrandUID);
                for (int i = 0; i < subCatList.Count; i++)
                {
                    var temp=subCatList[i];
                    strBuilder.Append(temp.ProductSubCat_Eng);
                    if (!string.IsNullOrEmpty(temp.ProductSubCat_Chi))
                    {
                        strBuilder.Append("&nbsp;");
                        strBuilder.Append(temp.ProductSubCat_Chi);
                    }
                    
                    if (i < subCatList.Count - 1)
                    { strBuilder.Append(" / ");}
                }
                return strBuilder.ToString();
            }
            
        }

        

    }
}
